<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../static/plugins/bootstrap-3.4.1-dist/css/bootstrap.min.css"/>
	</head>
	<body>
		<form style="margin: 0 100px;" action="案例1.html">
		  <div class="form-group">
		    <label for="exampleInputEmail1">用户名</label>
		    <input type="text" class="form-control" id="username" placeholder="用户名">
		  </div>
		  <div class="form-group">
		    <label for="exampleInputPassword1">密码</label>
		    <input type="password" class="form-control" id="pwd" placeholder="密码">
		  </div>
		  
		  
		  <button type="submit" class="btn btn-default" id="loginbtn">登录</button>
		</form>
		<script type="text/javascript" src="../../static/js/jquery-3.6.0.min.js">
			
		</script>
		<script type="text/javascript">
		
				$('#loginbtn').click(function(e){
					e.preventDefault()
					console.log(e)
					$.post('',{
						username:$('#username').val()
						password:$('#pwd').val()
						
					},function(res){
						console.log(res)
						localStorage.token=res.data.token
						localStorage.username=res.data.username
						//localStorage.password=res.data.password
						alert('登录成功')
						setTimeout(function(){
							
							localtion.href='案例1.html'
							
							
						},300)
						
					})
					
				})
				
				
		
		</script>
	</body>
</html>
